using System;
using System.Collections.Generic;
using System.Text;
using MacomberMap.Common.Types;
using System.Xml;

namespace MacomberMap.Common.Data
{
    /// <summary>
    /// This class holds information on a data type within a data source
    /// </summary>
    public class MM_Data_Type: MM_Serializable
    {
        #region Variable declarations
        /// <summary>The name of the data type</summary>
        public String Name;

        /// <summary>The abbreviation for the data type</summary>
        public String Abbreviation;

        /// <summary>The collection of data values</summary>
        public MM_Data_Value[] DataValues;

        /// <summary>The data source holding this point</summary>
        public MM_Data_Source Source;
        #endregion

        #region Initialization
        /// <summary>
        /// Initialize a new MM Data type
        /// </summary>
        /// <param name="BaseElement">The Xml element defining the data type</param>
        /// <param name="Source">The data source for this type</param>
        public MM_Data_Type(XmlElement BaseElement, MM_Data_Source Source) : base(BaseElement)
        {
            this.Source = Source;
            DataValues = new MM_Data_Value[BaseElement.ChildNodes.Count];
            int a=0;
            foreach (XmlElement xDataValue in BaseElement.ChildNodes)
                DataValues[a++] = new MM_Data_Value(xDataValue, this);
        }
        #endregion
    }
}
